<?php 
if(isset($_GET['id']))
{
	include_once 'chi-tiet-tin-tuc.php';
	return;
}
include_once 'php/lib/lib.php';
Common::init_website();
$query="SELECT * FROM tbl_news ORDER BY id DESC LIMIT 6";
$rows=Db::mysql_query($query,Config::$FETCH_MODE_TABLE);
ob_start();
?>
 
			<div class="componentheading">Tin tức</div>
<table class="contentpane" align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
	<td>
	<script language="javascript" type="text/javascript">

	function tableOrdering( order, dir, task )
	{
		var form = document.adminForm;

		form.filter_order.value 	= order;
		form.filter_order_Dir.value	= dir;
		document.adminForm.submit( task );
	}
</script>
<form action="tin-tuc.php" method="post" name="adminForm">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
	<td colspan="5">
		<table>
		<tbody><tr>
					<td nowrap="nowrap" align="left" width="60%">
				Tiêu đề cần tìm&nbsp;&nbsp;<input name="filter" class="inputbox" onchange="document.adminForm.submit();" type="text">
			</td>
							<td nowrap="nowrap" align="right" width="40%">
			&nbsp;&nbsp;&nbsp;Hiển thị #&nbsp;<select name="limit" id="limit" class="inputbox" size="1" onchange="this.form.submit()"><option value="5">5</option><option value="10">10</option><option value="15">15</option><option value="20">20</option><option value="25">25</option><option value="30">30</option><option value="50">50</option><option value="100">100</option><option value="0" selected="selected">All</option></select>			</td>
				</tr>
		</tbody></table>
	</td>
</tr>
<tr>
	<td class="sectiontableheader" align="right" width="5%">
		#.	</td>
		<td class="sectiontableheader">
		<a>Hình minh họa</a>	</td>
	 	<td class="sectiontableheader">
		<a href="javascript:tableOrdering('a.title','desc','');" title="Click to sort by this column">Tiêu đề</a>	</td>
		
				
			<td class="sectiontableheader" nowrap="nowrap" align="center" width="5%">
		<a href="javascript:tableOrdering('a.hits','desc','');" title="Click to sort by this column">Ngày đăng</a>	</td>
	</tr>
	<?php foreach ($rows as $key=>$row){?>
	<tr class="sectiontableentry1">
		<td align="right">
			<?php echo $key+1?>
		</td>
		<td align="right">
			<?php if($row['image']!=""){?>
			<img src='<?php echo $row['image'];?>' style='width:140px'/>
			<?php }?>
		</td>
		<td>
			<a href="tin-tuc.php?id=<?php echo $row['id']?>"><?php echo $row['title']?></a>
		</td>
		<td align="center">
			<?php echo date('d.m.Y',$row['create_time'])?>	
		</td>
	</tr>
	<?php }?>
</tbody>
</table>

<input name="id" value="32" type="hidden">
<input name="sectionid" value="16" type="hidden">
<input name="task" value="category" type="hidden">
<input name="filter_order" value="" type="hidden">
<input name="filter_order_Dir" value="" type="hidden">
<input name="limitstart" value="0" type="hidden">
<input name="viewcache" value="0" type="hidden">
</form>

		</td>
</tr>
</tbody></table>

<?php 
$params[0]="Tin tức, khuyến mãi, sự kiện";
$params[1]="Tin tức";
$params[2] = ob_get_contents();
ob_end_clean();
include_once 'php/layout.php';
?>	
			
		